

class FileCommand{
    
    static void execute(project,commandContext){
        //def packageName = project.properties['packageName']//project.groupId
        def baseDir = project.basedir
        //def templateDir = project.properties['templateDir']
                       
        //def dsonString = "~.Book:[@extends:~.domain.BaseEntity,age:[@type:long,@NotNull:true,@min:3,@max:5],chapters:[@type:List<~.Chapter:[@extends:~.domain.BaseChild, title,content:[@NotNull:true]]>],name,notes]";
        //def dsonString = "~.House:[rooms:[@type:long,@NotNull:true,@min:1,@max:8],name:[@min:3,@max:5],notes]";        
        //def dsonString = "~.Hotel:[age:[@type:long,@NotNull:true,@min:3,@max:5],build:[@type:Date],floors:[@type:List<~.Floor:[title,visited:[@type:date],content:[@NotNull:true]]>],name,notes]";
        
        //def dsonString=commandContext;        
        
        //CrudWriter cw = new CrudWriter(packageName, baseDir , templateDir , dsonString);        
        //cw.ifNotSatisfiedFail();
        //cw.write();
        
        println("-----FileCommand----- commandContext="+commandContext);
        File scriptFile=new File(baseDir,commandContext)
        def allLines = scriptFile.readLines()
        
        allLines.each{line ->
            if(-1!=line.indexOf("=")&&(!line.startsWith("#"))){
                def commandLineNameAndContext = line.split("=");
                def commandLineName = commandLineNameAndContext[0];
                def commandLineContext = commandLineNameAndContext[1];
                CommandProcessor.executeCommand(project, commandLineName, commandLineContext);
            }
        }
        
        
    }
}